/**
 * 用户信息相关接口
 */
import type { LoginParams, LoginResult, SendCodeParams } from './types';
import { get, post } from '@/utils/request';
import type { UserState } from '@/store/modules/user/types';

enum URL {
  login = '/auth/login',
  sendCode = '/auth/sendCode',
  logout = '/user/logout',
  getProfile = '/user/getProfile',
}

// 获取基础用户信息
export const getProfile = () => post<UserState>({ url: URL.getProfile });

// 用户登录
export const login = (data: LoginParams) => post<LoginResult>({ url: URL.login, data });

// 发送手机验证码
export const sendCode = (data: SendCodeParams) => post<any>({ url: URL.sendCode, data });

// 退出登录
export const logout = () => get<any>({ url: URL.logout });
